<template>
  <div>
    <el-dialog :title="title" :visible.sync="alertShow" width="80%" :close-on-click-modal="false" :show-close="false" :append-to-body="true"	>
      <div style="
    position: absolute;
    top: 2%;
    right: 20px;
    font-size: 20px;
      cursor: pointer;
" @click="clone">
        <i class="el-icon-close"></i>
      </div>
      <slot></slot>

      <div class="btn_box">
        <div class="right_box text" @click="confirm">
          {{ rightText }}
        </div>
        <div class="left_box text" @click="cancel">
          {{ leftText }}
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: {
    alertShow: Boolean,
    title: String,
    rightText: String,
    leftText: String,
  },
  methods: {
    confirm() {
      this.$emit("confirm")
    },
    cancel() {
      this.$emit("cancel")
    },
    clone() {
      this.$emit("clone")
    }
  }
};
</script>

<style lang="scss" scoped>
::v-deep .el-dialog__header {
  background-color: #eeeeee;
  border-radius: 15px 15px 0 0;
}

::v-deep .el-dialog {
  position: relative;
  margin: 0 auto 50px;
  background: #fff;
  border-radius: 15px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 30%);
  box-sizing: border-box;
  width: 50%;
}

::v-deep .el-dialog__header {
  padding: 20px 20px 20px;
}

::v-deep .el-dialog__headerbtn {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 0;
  background: 0 0;
  border: none;
  outline: 0;
  cursor: pointer;
  font-size: 24px;
}

.btn_box {
  width: 100%;
  height: 80px;
  line-height: 80px;
  text-align: center;
}

.text {
  width: 115px;
  height: 35px;
  border: 1px solid #e04e2f;
  display: inline-block;
  border-radius: 8px;
  text-align: center;
  line-height: 35px;
  color: #fff;
  background-color: #e04e2f;
  cursor: pointer;
}

.right_box {
  margin-right: 10px;
}

.left_box {
  margin-left: 10px;
  background-color: #fff;
  color: #e04e2f;
}
</style>
